<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{economyGameAction}" />
	
	<span class="pagetitle">游戏内分析 —— 经济统计</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
        <p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd" />
		-
		<p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd" />
		&#160;&#160;&#160;
		
		<p:selectOneMenu id="platformSel" styleClass="queryPlatform" value="#{bean.queryPlatform}">
	        <f:selectItems value="#{bean.platformItmes}" />
	        <p:ajax update="channelSel serverSel" listener="#{bean.updateChannelItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="channelSel" styleClass="queryChannel" value="#{bean.queryChannel}">
	        <f:selectItems value="#{bean.channelItmes}" />
	        <p:ajax update="serverSel platformSel" listener="#{bean.updateServerItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{bean.queryServer}">
	         <f:selectItems value="#{bean.serverItmes}" />
	         <p:ajax update="channelSel platformSel" listener="#{bean.selectedServer}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;

        <p:selectOneMenu id="yuanbao" styleClass="queryServer" value="#{bean.queryCurType}">
            <f:selectItems value="#{bean.yuabaoItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;

        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
        <p:panel id="panel100" header="概览" style="margin-bottom:10px;">
            <p:dataGrid id="chart100" var="c" value="#{bean.yuanbaoSumChart}" columns="1" layout="grid">
                <p:panel style="text-align:center">
                    <h:panelGrid columns="1" style="width:100%">
                        <div id="highchartChart100" style="width:100%;height:350px; border:0;">
                            <script type="text/javascript">
                                generateChart('#{c.jsonStr}', '#{c.jsonType}', '100');
                            </script>
                        </div>
                    </h:panelGrid>
                </p:panel>
            </p:dataGrid>

            <p:accordionPanel activeIndex="-1">
                <p:tab title="点击查看详细数据">
                    <p:dataTable id="dlist100" var="l" value="#{bean.yuanbaoSumDatas}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                        <f:facet name="{Exporters}">
                            <h:commandLink styleClass="exporter">
                                <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                                <p:dataExporter type="xls" target="dlist100" fileName="YuanbaoSumDatas-#{pageHelper.getNewDateDetailStr()}"/>
                            </h:commandLink>
                        </f:facet>

                        <p:column headerText="日期" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{l.day}" />
                        </p:column>
                        <p:column headerText="平台" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{pageHelper.getPlatformNameById(l.platformId)}" />
                        </p:column>
                        <p:column headerText="渠道" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{pageHelper.getChannelNameById(l.channelId)}" />
                        </p:column>
                        <p:column headerText="区服" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{pageHelper.getServerNameById(l.serverId)}" />
                        </p:column>
                        <p:column headerText="产出" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{l.add}" />
                        </p:column>
                        <p:column headerText="消耗" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{l.plus}" />
                        </p:column>
                        <p:column headerText="剩余" styleClass="column" style="width:80px">
                            <h:outputLabel value="#{l.rest}" />
                        </p:column>
                    </p:dataTable>
                </p:tab>
            </p:accordionPanel>
        </p:panel>
        <br />
        <p:separator />

        <p:panel id="panel200" header="货币消耗途径(TOP20)" style="margin-bottom:10px;">
            <p:dataGrid id="chart3" var="c" value="#{bean.yuanbaoConsumeChart}" columns="1" layout="grid">
                <p:selectOneMenu value="#{c.selectItem}" styleClass="queryServer">
                    <f:selectItems value="#{c.allItmes}" />
                    <p:ajax update="chart3" listener="#{bean.handleYuanbaoConsumeChange}" />
                </p:selectOneMenu>

                <p:panel style="text-align:center">
                    <h:panelGrid columns="1" style="width:100%">
                        <div id="highchartChart3" style="width:100%;height:400px; border:0;">
                            <script type="text/javascript">
                                generateChart('#{c.jsonStr}', '#{c.jsonType}', '3');
                            </script>
                        </div>
                    </h:panelGrid>
                </p:panel>
            </p:dataGrid>

            <p:accordionPanel activeIndex="-1">
                <p:tab title="点击查看详细数据">
                    <p:dataTable id="dlist4" var="l" value="#{bean.yuanbaoConsumeData}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                        <f:facet name="{Exporters}">
                            <h:commandLink styleClass="exporter">
                                <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                                <p:dataExporter type="xls" target="dlist4" fileName="yuanbaoConsumeData-#{pageHelper.getNewDateDetailStr()}"/>
                            </h:commandLink>
                        </f:facet>

                        <p:column headerText="消耗途径" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeWayStr} (#{l.consumeWay})" />
                        </p:column>
                        <p:column headerText="消耗量" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeCount}" />
                        </p:column>
                        <p:column headerText="消耗量占比" styleClass="column grcnewUser">
                            <h:outputLabel value="#{bean.getDouble2Percent(l.consumeCountRadio)}" />
                        </p:column>
                        <p:column headerText="消耗人数" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeUser}" />
                        </p:column>
                        <p:column headerText="消耗人数占比" styleClass="column grcnewUser">
                            <h:outputLabel value="#{bean.getDouble2Percent(l.consumeUserRadio)}" />
                        </p:column>
                    </p:dataTable>
			    </p:tab>
		    </p:accordionPanel>
        </p:panel>

        <p:panel id="panel300" header="商城道具相关货币消耗途径(TOP20)" style="margin-bottom:10px;">
            <p:dataGrid id="chart4" var="c" value="#{bean.shangchengConsumeChart}" columns="1" layout="grid">
                <p:selectOneMenu value="#{c.selectItem}" styleClass="queryServer">
                    <f:selectItems value="#{c.allItmes}" />
                    <p:ajax update="chart4" listener="#{bean.handleYuanbaoConsumeChange1}" />
                </p:selectOneMenu>

                <p:panel style="text-align:center">
                    <h:panelGrid columns="1" style="width:100%">
                        <div id="highchartChart4" style="width:100%;height:400px; border:0;">
                            <script type="text/javascript">
                                generateChart('#{c.jsonStr}', '#{c.jsonType}', '4');
                            </script>
                        </div>
                    </h:panelGrid>
                </p:panel>
            </p:dataGrid>

            <p:accordionPanel activeIndex="-1">
                <p:tab title="点击查看详细数据">
                    <p:dataTable id="dlist5" var="l" value="#{bean.shangchengConsumeDatas}"  resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                        <f:facet name="{Exporters}">
                            <h:commandLink styleClass="exporter">
                                <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                                <p:dataExporter type="xls" target="dlist5" fileName="ShangchengConsumeDatas-#{pageHelper.getNewDateDetailStr()}"/>
                            </h:commandLink>
                        </f:facet>

                        <p:column headerText="道具名称" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeWayStr} (#{l.consumeWay})" />
                        </p:column>
                        <p:column headerText="消耗量" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeCount}" />
                        </p:column>
                        <p:column headerText="消耗量占比" styleClass="column grcnewUser">
                            <h:outputLabel value="#{bean.getDouble2Percent(l.consumeCountRadio)}" />
                        </p:column>
                        <p:column headerText="消耗人数" styleClass="column grcnewUser">
                            <h:outputLabel value="#{l.consumeUser}" />
                        </p:column>
                        <p:column headerText="消耗人数占比" styleClass="column grcnewUser">
                            <h:outputLabel value="#{bean.getDouble2Percent(l.consumeUserRadio)}" />
                        </p:column>
                    </p:dataTable>
                </p:tab>
            </p:accordionPanel>
        </p:panel>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>